package com.bupt.liutong.admin.sch.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.bupt.liutong.admin.core.base.BaseAction;
import com.bupt.liutong.admin.sch.bo.IntroBo;
import com.bupt.liutong.admin.sch.bo.IntroPhotoBo;
import com.bupt.liutong.admin.sch.form.IntroForm;

public class IntroAction extends BaseAction {
	
	private IntroBo introBo;
	private IntroPhotoBo introPhotoBo;
	
	public ActionForward updateIntro(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		request.setAttribute("sch_intro", introBo.getIntro());
		request.setAttribute("photoFormList", introPhotoBo.getIntroPhotos());
		return mapping.findForward("updateIntroSuccess");
	}
	
	public ActionForward updateIntroDo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		introBo.updateIntro((IntroForm) form, request);
		return this.updateIntro(mapping, form, request, response);
		//return mapping.findForward("updateIntroDoSuccess");
	}
	
	public ActionForward updateBriefIntro(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) {
		request.setAttribute("sch_brief_intro", introBo.getBriefIntro());
		return mapping.findForward("updateBriefIntroSuccess");
	}

	public ActionForward updateBriefIntroDo(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) {
		introBo.updateBriefIntro((IntroForm) form);
		return this.updateBriefIntro(mapping, form, request, response);
		//return mapping.findForward("updateBriefIntroDoSuccess");
	}

	public void setIntroBo(IntroBo introBo) {
		this.introBo = introBo;
	}

	public void setIntroPhotoBo(IntroPhotoBo introPhotoBo) {
		this.introPhotoBo = introPhotoBo;
	}
}
